package com.ctshk.rpc.custom.mapper;

import com.ctshk.rpc.custom.dto.quotation.QuetationAmountInfoDTO;
import com.ctshk.rpc.custom.dto.quotation.TouristPriceDTO;
import com.ctshk.rpc.custom.entity.CustomizedQuotationTouristPrice;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 * 游客服务价格 Mapper 接口
 * </p>
 *
 * @author 谢诗宏
 * @since 2021-01-16
 */
public interface CustomizedQuotationTouristPriceMapper extends BaseMapper<CustomizedQuotationTouristPrice> {

    /**
     * 获取人均服务项列表
     * @param serviceItemId
     * @param quotationId
     * @return
     */
    @Select("SELECT a.tourist_type_id,a.tourist_type_name,a.total_price,b.people_num\n" +
            "FROM t_customized_quotation_tourist_price a LEFT JOIN t_customized_quotation_tourist_type b ON a.tourist_type_id = b.main_data_id \n" +
            "where a.service_item_id = #{service_item_id} AND b.quotation_id = #{quotation_id} GROUP BY b.main_data_id")
    List<TouristPriceDTO> queryListByServiceItem(@Param("service_item_id")Long serviceItemId,@Param("quotation_id")Long quotationId);

}
